@(movie: Movie, lastSubmitDate:Date, movieSessionCreateForm: Form[MovieSessionCreateForm])(implicit lang: Lang)

@import java.util._
@import helper._

@implicitFieldConstructor = @{ FieldConstructor(bootstrap.render) }

@main("About The Cult Cinema Inc.") {

	<section style="padding-top:60px">


		<div class="row">
			<div class="span12">
				<ul class="breadcrumb">
					<li><a href="@routes.Application.index(lang.code)">@Messages("home")(lang)</a> <span class="divider">/</span></li>
        			<li><a href="#">@Messages("staff.movie.manage")(lang)</a> <span class="divider">/</span></li>
					<li><a href="@routes.Staff.sessionEditor(lang.code)">@Messages("staff.movie.session.editor")(lang)</a> <span class="divider">/</span></li>
					<li class="active">@Messages("staff.movie.add")(lang)</li>
        		</ul>
			</div>
		</div>

		@if(movieSessionCreateForm.hasErrors) {
			<div class="row">
				<div class="span12">
		    	    <div class="alert-error alert alert-block">
		    	    	<h4 class="alert-heading">@Messages("error")(lang)
			    	    	@if(movieSessionCreateForm.hasGlobalErrors) { # @Messages(movieSessionCreateForm.globalError.message)(lang) }
		    	    	</h4>
			    	</div>
				</div>
			</div>
		}

		<div class="row">

			<div class="span2">
				@moviesSideBar(lang)
			</div>

			<div class="span10">
				<div class="well">
					<h3>@Messages("staff.movie.session.editor")(lang)</h3>

					@helper.form(action = routes.Staff.submitSessionCreation, 'class -> "form-horizontal") {

				        <fieldset>
				            <legend><i class="icon-film"></i> @movie.infos.get(0).name</legend>




							<div class="control-group ">
								<label class="control-label" for="showtime">@Messages("staff.movie.showtime")(lang)</label>
								<div class="controls">

									<div id="datetimepicker" class="input-append date">
										<input data-format="dd/MM/yyyy hh:mm" name="showtime" type="text"></input>
										<span class="add-on">
										  <i data-time-icon="icon-time" data-date-icon="icon-calendar">
										  </i>
										</span>
									</div>
								</div>
							</div>

							@inputText(
					            movieSessionCreateForm("price"),
					            '_label -> Messages("movie.price")(lang)

					        )

							@select(
								movieSessionCreateForm("house_id"),
								options("1"->"1", "2"->"2", "3"->"3", "4"->"4"),
								'_label -> Messages("staff.house")(lang)
								)

							@select(
								movieSessionCreateForm("movieLang"),
								options("0"->Messages("movie.language",0)(lang), "1"->Messages("movie.language",1)(lang), "2"->Messages("movie.language",2)(lang) ),
								'_label -> Messages("staff.movie.language")(lang)
							)




							<input type="hidden" name="movie_id" value="@movie.id">
							<input type="hidden" name="lang" value="@lang.code">



					    </fieldset>

					    <div class="form-actions">
					       	<button type="submit" class="btn btn-primary">@Messages("staff.movie.add")(lang)</button>
					      	<button type="reset" class="btn">@Messages("register.reset")(lang)</button>
					    </div>
					}
				</div>
			</div>

		</div>


  	</section>

	<script type="text/javascript">
	  $(function() {
		$('#datetimepicker').datetimepicker({
		  language: 'pt-BR'
		});


		@{
			if(lastSubmitDate!=null){
				var c = Calendar.getInstance();
				c.setTime(lastSubmitDate);

				Html("var year = " + c.get(Calendar.YEAR) + ";" +
					"var month = " + c.get(Calendar.MONTH) + ";" +
					"var day = " + c.get(Calendar.DAY_OF_MONTH) + ";" +
					"var hour = " + c.get(Calendar.HOUR_OF_DAY) + ";" +
					"var min = " + c.get(Calendar.MINUTE) + ";" );
			}

		}

		var picker = $('#datetimepicker').data('datetimepicker');
		picker.setLocalDate(new Date(year,month,day,hour,min));
		picker.setDate(new Date(Date.UTC(year,month,day,hour,min)));

	  });
	</script>

}(lang)